//////////////////////////////////////////////////////////////////////////

#ifndef _CREATEMENU_H_
#include "createmenu.h"
#endif

//////////////////////////////////////////////////////////////////////////

#ifndef _CONTROL_H_
#include "control.h"
#endif

#ifndef _BUTTON_H_
#include "button.h"
#endif

#ifndef _EDIT_H_
#include "edit.h"
#endif

#ifndef _SURFACE_H_
#include "surface.h"
#endif

#ifndef _THEME_H_
#include "theme.h"
#endif

//////////////////////////////////////////////////////////////////////////


GUI_CreateMenu::GUI_CreateMenu()
{
    m_Buffer = 0;
    m_Controls.resize(GUI_CreateMenu::ButtonCount);
    m_Labels.resize(GUI_CreateMenu::LabelCount);
    m_FocusedControl = -1;

    m_Labels[GUI_CreateMenu::CreateLabel] = new GUI_Button(GUI_Images::Empty, GUI_Fonts::CaptionText, GUI_Colors::ButtonText, "Create", GUI_Images::Empty, 0.1f, 0.3f, GUI_Surface::AllignLeft, 0.01f, 0.0f);

    m_Labels[GUI_CreateMenu::Map] = new GUI_Button(GUI_Images::Empty, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "Map", GUI_Images::Empty, 0.1f, 0.5f, GUI_Surface::AllignLeft, 0.01f, 0.0f);

    m_Controls[GUI_CreateMenu::PreviousMap] = new GUI_Button(GUI_Images::ButtonLeft, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "", GUI_Images::ButtonLeftHover, 0.4f, 0.5f);
    m_Labels[GUI_CreateMenu::MapName] = new GUI_Button(GUI_Images::Empty, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "current", GUI_Images::Empty, 0.5f, 0.5f);
    m_Controls[GUI_CreateMenu::NextMap] = new GUI_Button(GUI_Images::ButtonRight, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "", GUI_Images::ButtonRightHover, 0.6f, 0.5f);

    m_Labels[GUI_CreateMenu::UserNameLabel] = new GUI_Button(GUI_Images::Empty, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "User Name", GUI_Images::Empty, 0.1f, 0.6f, GUI_Surface::AllignLeft, 0.01f, 0.0f);
    m_Controls[GUI_CreateMenu::UserName] = new GUI_Edit(GUI_Images::Edit, GUI_Fonts::EditText, GUI_Colors::EditText, "Noname", GUI_Images::EditHover, 0.5f, 0.6f);

    m_Labels[GUI_CreateMenu::MapPreview] = new GUI_Button(GUI_Images::MapPreview, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "", GUI_Images::Empty, 0.5f, 0.3f);

    m_Controls[GUI_CreateMenu::Create] = new GUI_Button(GUI_Images::ButtonGreen, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "Create", GUI_Images::ButtonGreenHover, 0.2f, 0.7f);
    m_Controls[GUI_CreateMenu::Cancel] = new GUI_Button(GUI_Images::ButtonRed, GUI_Fonts::ButtonText, GUI_Colors::ButtonText, "Cancel", GUI_Images::ButtonRedHover, 0.2f, 0.8f);

}


//////////////////////////////////////////////////////////////////////////


GUI_CreateMenu::~GUI_CreateMenu()
{
    for (int i = 0; i < m_Controls.size(); ++i)
        delete m_Controls[i];
    for (int i = 0; i < m_Labels.size(); ++i)
        delete m_Labels[i];
}


////////////////////////////////////////////////////////////////////////////

    
bool GUI_CreateMenu::SetMapName(const std::string& _name)
{
    ((GUI_Button *)m_Labels[GUI_CreateMenu::MapName])->SetText(_name);
    GUI_Theme::ReloadMapImages(_name);
    m_Labels[GUI_CreateMenu::MapPreview]->Resize();
    return true;
}


////////////////////////////////////////////////////////////////////////////
